package com.hrbxlh.virtualization.vo;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.List;

/**
 * @author cheer
 */
public class CourseImageAllocationVO {

    /**
     * 课程Id
     */
    private Integer courseId;

    /**
     * 课程名称
     */
    private String courseName;

    /**
     * 课程图标
     */
    private String courseTitle;

    /**
     * 课程颜色
     */
    private String courseColor;

    /**
     * 是否分配
     */
    private Boolean allocated;

    /**
     * 课程镜像名称列表
     */
    private List<Image> images;

    /**
     * 已分配的章节数量/总章节数量
     */
    private String allocatedCount;

    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getCourseTitle() {
        return courseTitle;
    }

    public void setCourseTitle(String courseTitle) {
        this.courseTitle = courseTitle;
    }

    public String getCourseColor() {
        return courseColor;
    }

    public void setCourseColor(String courseColor) {
        this.courseColor = courseColor;
    }

    public Boolean getAllocated() {
        return allocated;
    }

    public void setAllocated(Boolean allocated) {
        this.allocated = allocated;
    }

    public List<Image> getImages() {
        return images;
    }

    public void setImages(List<Image> images) {
        this.images = images;
    }

    public String getAllocatedCount() {
        return allocatedCount;
    }

    public void setAllocatedCount(String allocatedCount) {
        this.allocatedCount = allocatedCount;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("courseId", courseId)
                .append("courseName", courseName)
                .append("courseTitle", courseTitle)
                .append("courseColor", courseColor)
                .append("allocated", allocated)
                .append("images", images)
                .append("allocatedCount", allocatedCount)
                .toString();
    }

    public static class Image {

        private String imageName;

        private String imageType;

        private Boolean broken;

        public Image() {
        }

        public Image(String imageName, String imageType, Boolean broken) {
            this.imageName = imageName;
            this.imageType = imageType;
            this.broken = broken;
        }

        public String getImageName() {
            return imageName;
        }

        public void setImageName(String imageName) {
            this.imageName = imageName;
        }

        public String getImageType() {
            return imageType;
        }

        public void setImageType(String imageType) {
            this.imageType = imageType;
        }

        public Boolean getBroken() {
            return broken;
        }

        public void setBroken(Boolean broken) {
            this.broken = broken;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;

            if (o == null || getClass() != o.getClass()) return false;

            Image image = (Image) o;

            return new EqualsBuilder()
                    .append(imageName, image.imageName)
                    .append(imageType, image.imageType)
                    .isEquals();
        }

        @Override
        public int hashCode() {
            return new HashCodeBuilder(17, 37)
                    .append(imageName)
                    .append(imageType)
                    .toHashCode();
        }

        @Override
        public String toString() {
            return new ToStringBuilder(this)
                    .append("imageName", imageName)
                    .append("imageType", imageType)
                    .append("broken", broken)
                    .toString();
        }
    }
}
